<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\web\View;

/* @var $this yii\web\View */
/* @var $model app\models\DorminfoModel */
/* @var $form yii\widgets\ActiveForm */
$url=\Yii::getAlias('@web');
$js3=<<< Js
function myAjax(){
		var x=$("#dorminfomodel-stu_id").val();
		$.ajax({
                    url: '$url/personinfo/getname?stuid='+x,
                    type: 'get',
                    dataType: 'text',
                    success: function (data) {
                       $("#dorminfomodel-stu_name").val(data);
                    }
                });
}
Js;
$this->registerJs($js3, View::POS_END, 'myAjax0');
?>
<style>
input{
opacity: 1 !important;
}

</style>
<div class="dorminfo-model-form">

    <?php $form = ActiveForm::begin(); ?>

   <?= $form->field($model, 'stu_id')->textInput(['maxlength' => true,
    		'onblur'=>'myAjax()',
    ]) ?>
    
   <?= $form->field($model, 'stu_name')->textInput(['maxlength' => true,
    		'readonly'=>true,
    ]) ?>

    <?= $form->field($model, 'dorm_area')->textInput()->dropDownList(['0'=>'东校园','1'=>'西校园','2'=>'西校园南区']) ?>

    <?= $form->field($model, 'dormitory')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'dorm_num')->textInput(['maxlength' => true]) ?>

   
 <?php   $model->leader =  explode(',',$model->leader); //本句用法参见附录A第2篇文章
           echo  $form->field($model, 'leader')->checkboxList(['宿舍长'=>'宿舍长','楼层长'=>'楼层长','楼栋长'=>'楼栋长'],['unselect'=>'无',
 																											'class'=>'hahah1',
 																												'id'=>666,
           ] ) ?>


	
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '添加' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>




